from selenium import webdriver
from selenium.webdriver.common.by import By
import time

driver = webdriver.Chrome()
driver.get("https://www.baidu.com")
driver.maximize_window()

element = driver.find_element(By.LINK_TEXT,'新闻').click()
print(f'当前窗口句柄为:{driver.current_window_handle}')
print(f'所有窗口句柄为:{driver.window_handles}')

time.sleep(1)
driver.switch_to.window(driver.window_handles[0])

time.sleep(50)


